<?php
class FetchAction extends HomeAction{
    //下载远程图片
    public function down(){
        C('upload_http',1);
        $img = D('Img');
        $rs = D("Vod");
echo 234;exit;
        $count = $rs->where('Left(vod_pic,7)="http://"')->count('vod_id');
        $i = 0;
        do{

            $list = $rs->where('Left(vod_pic,7)="http://"')->order('vod_addtime desc')->limit(100)->select();
            foreach($list as $key=>$value){
                $i++;
                if (strpos($value['vod_pic'],'.jpg') || strpos($value['vod_pic'],'.png') || strpos($value['vod_pic'],'.bmp'))
                {
                    $imgnew = $img->down_load($value['vod_pic'],'vod');
                    if($value['vod_pic'] == $imgnew){
                        $rs->where('vod_id='.$value['vod_id'])->setField('vod_pic',str_replace("http://","httpf://",$value['vod_pic']));
                        echo $i." ".$value['vod_pic'].'下载失败!'."\n";
                    }else{
                        $rs->where('vod_id = '.$value['vod_id'])->setField('vod_pic',$imgnew);
                        echo $i." ".$value['vod_pic'].'下载成功!'."\n";
                    }
                }
            }
            sleep(2);
        }while($i<$count);


    }
}